# -*- coding: utf-8 -*-
# @Time    : 2021/9/1 10:38
# @Author  : BrandonGT
# @FileName: 12_PyQt5_QLayout.py

# 1. 导入包和模块
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
import sys

# 2. 创建一个应用程序对象
app = QApplication(sys.argv)

# 3. 创建控件
window = QWidget()

# 3.1 设置控件
window.setWindowTitle("")
window.resize(500, 500)

la1 = QLabel("标签1")
la1.setStyleSheet("background-color: cyan;")
la2 = QLabel("标签2")
la2.setStyleSheet("background-color: yellow;")
la3 = QLabel("标签3")
la3.setStyleSheet("background-color: red;")

layout = QHBoxLayout()
layout.addWidget(la1)
layout.addWidget(la2)
layout.addWidget(la3)

layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(0)


window.setLayout(layout)
window.setLayoutDirection(Qt.RightToLeft)

# 3.2 展示控件
window.show()

# 4. 应用程序执行，进入消息循环
sys.exit(app.exec_())